import java.util.*;

public class CalendarSeeker {
    public static void main(String[] args) {
        Scanner keybordInput = new Scanner(System.in);
        System.out.print("Input date:");
        int day = keybordInput.nextInt();
        String month = keybordInput.next();
        int year = keybordInput.nextInt();
        int monthNumber = 0;
        //enum Month {JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC};
        
        if (month.equals("January")) {
            monthNumber = 11;
        }
        if (month.equals("February")) {
            monthNumber = 12;
        }
        if (month.equals("March")) {
            monthNumber = 1;
        }
        if (month.equals("April")) {
            monthNumber = 2;
        }
        if (month.equals("May")) {
            monthNumber = 3;
        }
        if (month.equals("June")) {
            monthNumber = 4;
        }
        if (month.equals("July")){
            monthNumber = 5;
        }
        if (month.equals("August")) {
            monthNumber = 6;
        }
        if (month.equals("September")) {
            monthNumber = 7;
        }
        if (month.equals("October")) {
            monthNumber = 8;
        }
        if (month.equals("November")) {
            monthNumber = 9;
        }
         if (month.equals("December")) {
            monthNumber = 10;
        }
        
        int passedYearInCentury = year % 100;
        int passedCentury = year / 100;
        
        if (year == 2000 && monthNumber == 11 || monthNumber == 12) {
            passedCentury -=1;
        }
        
        if( monthNumber == 11 || monthNumber == 12) {
            passedYearInCentury -=1;
        }
        
        int result;
        result = (day+((13*monthNumber-1)/5)+passedYearInCentury+(passedYearInCentury/4)+(passedCentury/4)-2*passedCentury)%7;
        if (result< 0 )
            result +=7;
        
        switch (result) {
            case 0:
                System.out.println("Sunday");
                break;
            case 1:
                System.out.println("Monday");
                break;
            case 2:
                System.out.println("Tuesday");
                break;
            case 3:
                System.out.println("Wednesday");
                break;
            case 4:
                System.out.println("Thursday");
                break;
            case 5:
                System.out.println("Friday");
                break;
            case 6:
                System.out.println("Saturday");
                break;
        }
        
    }
}